]> dgit.raspbian.org Git - gnome-shell.git/commitdiff
viewSelector: Open context for highlighted search result
authorFlorian Müllner <fmuellner@gnome.org>
Tue, 15 Aug 2017 23:25:15 +0000 (01:25 +0200)
committerFlorian Müllner <fmuellner@gnome.org>
Thu, 17 Aug 2017 14:58:17 +0000 (16:58 +0200)
To make search more efficient, users don't need to move the actual
keyboard focus away from the search entry to activate the first
result. However the shift+f10 shortcut to pop up the context menu
via keyboard still acts on the actually focused widget, which is
the entry. It makes more sense to open the context menu of the
selected result instead, as that's what's highlighted and responds
to keyboard activation.

https://bugzilla.gnome.org/show_bug.cgi?id=675315

js/ui/search.js
js/ui/viewSelector.js

index c399880f544a145e8b1040b14f1be9ae8e1b4245..30e2b301d1eb5b57d313593d03de30ba1028c1b0 100644 (file)
@@ -681,6 +681,15 @@ var SearchResults = new Lang.Class({
         this._setSelected(this._defaultResult, highlight);
     },
 
+    popupMenuDefault: function() {
+        // If we have a search queued up, force the search now.
+        if (this._searchTimeoutId > 0)
+            this._doSearch();
+
+        if (this._defaultResult)
+            this._defaultResult.actor.popup_menu();
+    },
+
     navigateFocus: function(direction) {
         let rtl = this.actor.get_text_direction() == Clutter.TextDirection.RTL;
         if (direction == Gtk.DirectionType.TAB_BACKWARD ||
index ba7f46c7193eb4b58d557c630afc7ed416a26445..7131f77bdb1798a88945152374d1c1c325513bec 100644 (file)
@@ -163,6 +163,13 @@ var ViewSelector = new Lang.Class({
         this._text.connect('key-focus-out', Lang.bind(this, function() {
             this._searchResults.highlightDefault(false);
         }));
+        this._entry.connect('popup-menu', () => {
+            if (!this._searchActive)
+                return;
+
+            this._entry.menu.close();
+            this._searchResults.popupMenuDefault();
+        });
         this._entry.connect('notify::mapped', Lang.bind(this, this._onMapped));
         global.stage.connect('notify::key-focus', Lang.bind(this, this._onStageKeyFocusChanged));